set -s escape-time 0

# 颜色
set -g default-terminal "xterm-256color"
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'


set-option -g prefix2 `

bind C-b last-window
bind-key ` last-window
bind-key e send-prefix

bind-key r source-file ~/.tmux.conf # 自动刷新配置

bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R

set-option -g history-limit 5000 

setw -g mouse off 

# vi 模式
setw -g mode-keys vi

# 复制
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind p pasteb

if-shell "uname | grep -q Darwin" {
  bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
  bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
} {
  bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
  bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
}


set -g renumber-windows   on    # 关掉某个窗口后，编号重排
set-option -g allow-rename off # 关闭窗口重命名

# 新窗口当前路径
bind c new-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"

# 状态栏设置
set -g status-position bottom
set -g status-interval 5 # 状态栏刷新时间
set -g status-justify centre # 居中

set -g status-style "bg=#1C1C1C, fg=white" # 状态栏前景背景色

set -g status-left " ❐ #S " # 状态栏左侧内容
set -g status-right " #(whoami) / %H:%M " # 状态栏右侧内容


set -wg window-status-format " #I #W " # 状态栏窗口名称格式
set -wg window-status-current-format " #I:#W " # 状态栏当前窗口名称格式(#I：序号，#W：窗口名称，#F：window flags )
set -wg window-status-separator "" # 状态栏窗口名称之间的间隔
set -wg window-status-current-style "bg=#36648B, fg=white" # 状态栏当前窗口名称的样式
set -wg window-status-last-style "bg=#4F4F4F" # 状态栏最后一个窗口名称的样式
